<template>
  <div class="go">
    <button @click="showView=true;$router.push('/go-step1')">第一步</button>
    <button @click="showView=true;$router.push('/go-step2')">第二步</button>
    <button @click="showView=true;$router.push('/go-step3')">第三步</button>
    <button @click="showView=true;$router.push('/go-step4')">第四步</button>
    <button @click="showView=true;$router.push('/go-step5')">第五步</button>


    <button @click="$router.go(-3)">后退三步</button>
    <button @click="$router.go(1)">前进一步</button>
    <button @click="$router.go(10)">前进十步</button>

    <div class="go-view" v-if="showView">
      <div class="go-view__to">
        {{ $route.path }}
      </div>
      <div class="go-view__matched">
        {{ $route.matched[0].path }}
      </div>

      <div class="go-view__actual">
        <RouterView/>
      </div>
    </div>
  </div>
</template>

<script>
import {defineComponent} from 'vue';

export default defineComponent({
  name: 'Go',
  data() {
    return {
      showView: false,
    };
  },
});
</script>

<style scoped>
button {
  margin-right: 10px;
  margin-bottom: 20px;
}

.go-view {
  height: 120px;
  width: 510px;
  border: 1px silver solid;
  display: flex;
  flex-flow: column;
  align-items: center;
  row-gap: 20px;
  padding: 20px;

  & > .go-view__to {
    font-size: 25px;
    font-weight: bold;
  }

  & > .go-view__matched {
    font-size: 14px;
    font-weight: bold;
    color: grey;
  }

  & > .go-view__actual {
    font-weight: bold;
    color: dodgerblue;
  }
}
</style>